<?php
require_once 'CMS/Util.php';

class DescriptionThing_Plugin_Init extends Zend_Controller_Plugin_Abstract {
	public $content = "";
	public $name = "";
	public $enable = "";
	public $order = "";
	public $type = "";
	public function preDispatch(Zend_Controller_Request_Abstract $request)
	{
		$this->name = "DescriptionThing_Plugin_Init";
		$this->enable = 0;
		$this->order = 0;
		$this->content = "";
		$this->type = "content";
	}
	
	public function postDispatch(Zend_Controller_Request_Abstract $request)
	{
		if($this->enable == 1)
		{
			require_once APPLICATION_PATH . '/widgets/descriptionthing/controllers/IndexController.php';
			
			$controller = new DescriptionThing_IndexController();
			$check = array($controller,"indexAction");
			if(is_callable($check))
			{
				$controller->indexAction();
				$data = (array)$controller->view;
				$view = APPLICATION_PATH . '/widgets/descriptionthing/views/scripts/index/index.phtml';
				$html = Util::get_include_contents($view, $data);
		        $this->content = $html;
			}
			else
			{
				 $this->content = "";
			}
		}
		else $this->content = "";
	}
}